﻿package Installer::Command::MakeHosts;

use JIP::ToolSet; # load my commonly-used modules in a single import
use parent qw( Build::Command );

sub execute {
    my $self = shift;

    $self->log->Note('executing "MakeHosts" command...');

    $self->orm->storage->dbh->do(
        q{CREATE TABLE `ftpHosts`
          (
              `hostId`            smallint(5)  unsigned NOT NULL auto_increment,
              `hostIp`            char(14)              NOT NULL,
              `nbn`               char(255)             NOT NULL default '-',
              `lastFastScan`      timestamp             NOT NULL default '2009-01-01 00:00:00',
              `lastIndexing`      timestamp             NOT NULL default '2009-01-01 00:00:00',
              `lastBuild`         timestamp             NOT NULL default '2009-01-01 00:00:00',
              `totalFilesSize`    bigint(20)   unsigned NOT NULL default '0',
              `totalFilesCounter` mediumint(8) unsigned NOT NULL default '0',
              PRIMARY KEY  (`hostId`),
              UNIQUE KEY `hostIp` (`hostIp`)
          )
          ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED}
    );

    $self->log->Note('"MakeHosts" finished');
}

1;
